﻿USE [master] 
GO
/****** Object:  Database [EDMS]    Script Date: 05/31/2014 19:23:44 ******/
CREATE DATABASE [EDMS] ON  PRIMARY 
( NAME = N'EDMS', FILENAME = N'G:\DATA\EDMS.mdf' , SIZE = 20048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'EDMS_log', FILENAME = N'G:\DATA\EDMS_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
ALTER DATABASE [EDMS] SET COMPATIBILITY_LEVEL = 100
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [EDMS].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [EDMS] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [EDMS] SET ANSI_NULLS OFF
GO
ALTER DATABASE [EDMS] SET ANSI_PADDING OFF
GO
ALTER DATABASE [EDMS] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [EDMS] SET ARITHABORT OFF
GO
ALTER DATABASE [EDMS] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [EDMS] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [EDMS] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [EDMS] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [EDMS] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [EDMS] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [EDMS] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [EDMS] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [EDMS] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [EDMS] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [EDMS] SET  DISABLE_BROKER
GO
ALTER DATABASE [EDMS] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [EDMS] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [EDMS] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [EDMS] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [EDMS] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [EDMS] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [EDMS] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [EDMS] SET  READ_WRITE
GO
ALTER DATABASE [EDMS] SET RECOVERY FULL
GO
ALTER DATABASE [EDMS] SET  MULTI_USER
GO
ALTER DATABASE [EDMS] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [EDMS] SET DB_CHAINING OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'EDMS', N'ON'
GO
USE [EDMS]
GO
/****** Object:  Table [dbo].[DocumentFolder]    Script Date: 05/31/2014 19:23:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[DocumentFolder](
	[DocumentFolderID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [Key3] PRIMARY KEY CLUSTERED 
(
	[DocumentFolderID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Employer]    Script Date: 05/31/2014 19:23:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Employer](
	[EmployerID] [uniqueidentifier] NOT NULL,
	[DocumentFolderID] [uniqueidentifier] NULL,
 CONSTRAINT [Key4] PRIMARY KEY CLUSTERED 
(
	[EmployerID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Employee]    Script Date: 05/31/2014 19:23:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Employee](
	[EmployeeID] [uniqueidentifier] NOT NULL,
	[DocumentFolderID] [uniqueidentifier] NULL,
 CONSTRAINT [Key2] PRIMARY KEY CLUSTERED 
(
	[EmployeeID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Contract]    Script Date: 05/31/2014 19:23:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Contract](
	[ContractID] [uniqueidentifier] NOT NULL,
	[DocumentFolderID] [uniqueidentifier] NULL,
	[EmployeeID] [uniqueidentifier] NOT NULL,
	[EmployerID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [Key5] PRIMARY KEY CLUSTERED 
(
	[ContractID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[Contact]    Script Date: 05/31/2014 19:23:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Contact](
	[ContactID] [uniqueidentifier] NOT NULL,
	[IsIndividual] [bit] NULL,
	[Name] [varchar](50) NOT NULL,
	[LastName] [varchar](50) NULL,
	[Email] [char](1) NULL,
	[DateOfBirth] [date] NULL,
	[EmployeeID] [uniqueidentifier] NULL,
	[EmployerID] [uniqueidentifier] NULL,
 CONSTRAINT [Key1] PRIMARY KEY CLUSTERED 
(
	[ContactID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[TimeSheet]    Script Date: 05/31/2014 19:23:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TimeSheet](
	[TimeSheetID] [uniqueidentifier] NOT NULL,
	[ContractID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [Key7] PRIMARY KEY CLUSTERED 
(
	[TimeSheetID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SalaryBenefits]    Script Date: 05/31/2014 19:23:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SalaryBenefits](
	[SalaryID] [uniqueidentifier] NOT NULL,
	[ContractID] [uniqueidentifier] NOT NULL,
 CONSTRAINT [Key6] PRIMARY KEY CLUSTERED 
(
	[SalaryID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Default [DF__Contact__DateOfB__7E6CC920]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[Contact] ADD  DEFAULT (getdate()) FOR [DateOfBirth]
GO
/****** Object:  ForeignKey [DocumentFolder_DocumentFolderID_Employer_DocumentFolderID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[Employer]  WITH CHECK ADD  CONSTRAINT [DocumentFolder_DocumentFolderID_Employer_DocumentFolderID] FOREIGN KEY([DocumentFolderID])
REFERENCES [dbo].[DocumentFolder] ([DocumentFolderID])
GO
ALTER TABLE [dbo].[Employer] CHECK CONSTRAINT [DocumentFolder_DocumentFolderID_Employer_DocumentFolderID]
GO
/****** Object:  ForeignKey [Employee_DocumentFolderID_DocumentFolder_DocumentFolderID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[Employee]  WITH CHECK ADD  CONSTRAINT [Employee_DocumentFolderID_DocumentFolder_DocumentFolderID] FOREIGN KEY([DocumentFolderID])
REFERENCES [dbo].[DocumentFolder] ([DocumentFolderID])
GO
ALTER TABLE [dbo].[Employee] CHECK CONSTRAINT [Employee_DocumentFolderID_DocumentFolder_DocumentFolderID]
GO
/****** Object:  ForeignKey [Contract_DocumentFolderID_DocumentFolder_DocuemntFolderID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[Contract]  WITH CHECK ADD  CONSTRAINT [Contract_DocumentFolderID_DocumentFolder_DocuemntFolderID] FOREIGN KEY([DocumentFolderID])
REFERENCES [dbo].[DocumentFolder] ([DocumentFolderID])
GO
ALTER TABLE [dbo].[Contract] CHECK CONSTRAINT [Contract_DocumentFolderID_DocumentFolder_DocuemntFolderID]
GO
/****** Object:  ForeignKey [Contract_EmployerID_Employer_EmployerID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[Contract]  WITH CHECK ADD  CONSTRAINT [Contract_EmployerID_Employer_EmployerID] FOREIGN KEY([EmployerID])
REFERENCES [dbo].[Employer] ([EmployerID])
GO
ALTER TABLE [dbo].[Contract] CHECK CONSTRAINT [Contract_EmployerID_Employer_EmployerID]
GO
/****** Object:  ForeignKey [Employee_EmployeeID_Contract_EmployeeID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[Contract]  WITH CHECK ADD  CONSTRAINT [Employee_EmployeeID_Contract_EmployeeID] FOREIGN KEY([EmployeeID])
REFERENCES [dbo].[Employee] ([EmployeeID])
GO
ALTER TABLE [dbo].[Contract] CHECK CONSTRAINT [Employee_EmployeeID_Contract_EmployeeID]
GO
/****** Object:  ForeignKey [Contact_EmployerID_Employer_EmployerID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[Contact]  WITH CHECK ADD  CONSTRAINT [Contact_EmployerID_Employer_EmployerID] FOREIGN KEY([EmployerID])
REFERENCES [dbo].[Employer] ([EmployerID])
GO
ALTER TABLE [dbo].[Contact] CHECK CONSTRAINT [Contact_EmployerID_Employer_EmployerID]
GO
/****** Object:  ForeignKey [Employee_EmployeeID_Cintact_EmployeeID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[Contact]  WITH CHECK ADD  CONSTRAINT [Employee_EmployeeID_Cintact_EmployeeID] FOREIGN KEY([EmployeeID])
REFERENCES [dbo].[Employee] ([EmployeeID])
GO
ALTER TABLE [dbo].[Contact] CHECK CONSTRAINT [Employee_EmployeeID_Cintact_EmployeeID]
GO
/****** Object:  ForeignKey [TimeSheet_ContractID_Contract_ContractID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[TimeSheet]  WITH CHECK ADD  CONSTRAINT [TimeSheet_ContractID_Contract_ContractID] FOREIGN KEY([ContractID])
REFERENCES [dbo].[Contract] ([ContractID])
GO
ALTER TABLE [dbo].[TimeSheet] CHECK CONSTRAINT [TimeSheet_ContractID_Contract_ContractID]
GO
/****** Object:  ForeignKey [Contract_ContractID_SalaryBenefits_ContractID]    Script Date: 05/31/2014 19:23:45 ******/
ALTER TABLE [dbo].[SalaryBenefits]  WITH CHECK ADD  CONSTRAINT [Contract_ContractID_SalaryBenefits_ContractID] FOREIGN KEY([ContractID])
REFERENCES [dbo].[Contract] ([ContractID])
GO
ALTER TABLE [dbo].[SalaryBenefits] CHECK CONSTRAINT [Contract_ContractID_SalaryBenefits_ContractID]
GO
